package com.innovation.chengzhangriji.ui.widget;

import android.app.Notification;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.Typeface;
import android.support.v7.widget.RecyclerView;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.text.style.SuggestionSpan;
import android.text.style.TextAppearanceSpan;
import android.view.View;

import com.innovation.chengzhangriji.R;

public class HistoryPhotoDateAdapterViewHolder extends RecyclerView.ViewHolder {

    private CuteTextView mTextDate;

    public HistoryPhotoDateAdapterViewHolder(View itemView) {
        super(itemView);
        mTextDate = (CuteTextView) itemView.findViewById(R.id.text_date);
    }

    public void setDate(String title) {
        SpannableString span = new SpannableString(title);
        int index = title.indexOf("备孕中");
        if(index != -1) {
            span.setSpan(new AbsoluteSizeSpan(21, true), 0, index + 3, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
            span.setSpan(new AbsoluteSizeSpan(12, true), index + 3, index + 4, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
            span.setSpan(new AbsoluteSizeSpan(12, true), index + 4, title.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
            span.setSpan(new ForegroundColorSpan(Color.parseColor("#6e6e70")), index + 4, title.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
        }
        mTextDate.setText(span);
    }
}
